package com.stateflow.facade.common.exception;

import com.stateflow.facade.common.enums.CommonErrorEnum;

/**
 * Created by weiqingming on 2019/4/16.
 * 公用的自定义异常
 */
public class CommonException extends RuntimeException {

    private String errorMsg;
    private String errorCode;

    public CommonException(String errorMsg) {
        super(errorMsg);
        this.errorMsg = errorMsg;
    }

    public CommonException(CommonErrorEnum errorEnum) {
        super(errorEnum.getDesc());
        this.errorCode = errorEnum.getCode();
        this.errorMsg = errorEnum.getDesc();
    }

    public CommonException(String msg, Throwable cause) {
        super(msg, cause);
        this.errorMsg = errorMsg;
    }

    public CommonException(String msg, String code, Throwable cause) {
        super(msg, cause);
        this.errorMsg = msg;
        this.errorCode = code;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }
}
